cmake_minimum_required(VERSION 3.14)
project(ActiveReturn_Ear_Source_AR_CD_ActvnMgr_AR_CD_ActvnMgr_test)

# 设置C++标准
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 使用vcpkg
if(DEFINED ENV{VCPKG_ROOT})
    set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
endif()

# 查找Google Test (包含GMock)
find_package(GTest REQUIRED)

# 包含目录
include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}\mocks
    ${CMAKE_CURRENT_SOURCE_DIR}\include
    ActiveReturn_Ear/Source
)

# 编译选项
if(MSVC)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
else()
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif()

# 源文件
set(SOURCES
    src\test.cpp
)

# 创建测试可执行文件
add_executable(${PROJECT_NAME}
    ${SOURCES}
)

# 链接库
target_link_libraries(${PROJECT_NAME}
    GTest::gtest_main
    GTest::gmock
)

# 启用测试
enable_testing()
add_test(NAME ${PROJECT_NAME}_UnitTest COMMAND ${PROJECT_NAME})